import Global from "../../../Global"
import cjs=createjs
//import createjs from "../../../../createjs"
export default class SignInButton extends cjs.Container{
    private _bg:cjs.ScaleBitmap
    private _label:cjs.Bitmap
    constructor(label:cjs.Bitmap){
        super()
        const lib=Global.getLibrary()
        const btbg=new lib.PinkButtonBG()
        btbg.cache(-2,-2,222,82)
        //背景
        this._bg=new cjs.ScaleBitmap(btbg.cacheCanvas as HTMLCanvasElement,new cjs.Rectangle(40,40,140,0))
        //this._bg.setDrawSize(this._w,this._h)
        //this._bg.setTransform(0,100,1,1,0,0,0,this._w/2,this._h/2)
        this.addChild(this._bg)
        const rect=label.getBounds()
        label.setTransform((222-rect.width)/2,(82-rect.height)/2)
        this.addChild(label)
        this._label=label
    }
    setSize(w:number,h:number):void{
        this._bg.setDrawSize(w,h)
        const rect=this._label.getBounds()
        this._label.setTransform((w-rect.width)/2,(h-rect.height)/2)
    }
    getBounds(): cjs.Rectangle {
        return this._bg.getBounds()
    }
}